package com.modifiertech.lineage.skills;

import com.feed_the_beast.ftblib.lib.icon.Icon;
import com.modifiertech.lineage.BaseConst;
import com.modifiertech.lineage.Lineage;
import com.modifiertech.lineage.api.PlayerData;
import com.modifiertech.lineage.api.PlayerDataSkill;
import com.modifiertech.lineage.client.gui.ftbint.GuiIconsV2;
import com.modifiertech.lineage.commands.CmdHelper;
import com.modifiertech.lineage.event.PlayerDataHandler;
import com.modifiertech.lineage.event.SkillLevelUpEvent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraftforge.event.entity.living.LivingHurtEvent;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class BlackMagic extends PlayerDataSkill {
    @Override
    protected Icon defineSkillIcon() {
        return GuiIconsV2.Mage_076;
    }

    @Override
    protected String defineSkillType() {
        return BaseConst.PLAYER_ADV_TAG__SKILLS_SPE;
    }

    @Override
    protected String defineSkillSecondType() {
        return BaseConst.PLAYER_ADV_SEC_TAG__SKILLS_STATE;
    }

    @Override
    protected String defineSkillName() {
        return "基础黑魔法";
    }

    @Override
    protected int defineSkillLevelDependency() {
        return 3;
    }

    @Override
    public String defineSkillDesc() {
        int skillLevel = getSkillLevel();
        return "基础巫师入门,每提升1级增加5点魔法上限."+
                (skillLevel>0?"\n效果:当前提供 §6§l"+skillLevel*5+" 魔法上限.":"") ;
    }

    @Override
    protected double defineSkillRowX() {
        return 1;
    }

    @Override
    protected double defineSkillColumnY() {
        return 1;
    }

    @Override
    protected int defineSkillCoolDown() {
        return -1;
    }

    @Override
    protected double defineSkillManaUse() {
        return 0;
    }

    @Override
    protected List<String> defineSkillDependencyName() {
        return new ArrayList<>();
    }

    @Override
    protected int defineSkillRegion() {
        return 0;
    }

    @Override
    protected int defineUpgradePoint() {
        return 1;
    }

    @Override
    public void onSkillLevelUp(SkillLevelUpEvent.Post even) {
        //每升级一次增加一定魔法上限
        PlayerData playerData = PlayerDataHandler.get(even.getEntityPlayer());
        playerData.manaModifierUpdate("SKILL:"+getSkillName(), Double.valueOf(getSkillLevel()*5));
        playerData.manaDataUpdate();
        playerData.saveAndSyncSilent();
    }
}
